package com.cn.wanxi.springtask.async;

import lombok.extern.log4j.Log4j2;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @ClassName AsyncDemo
 * @Description 异步Demo类
 * @Author JiJiang
 * @Date 2022/9/29 14:33
 * @Version 1.0
 */

@Component
@Log4j2
public class AsyncDemo {


    public void normalMethod() {
        log.info("这是一个普通的方法，执行该方法的线程名为{}", Thread.currentThread().getName());
    }

    @Async
    public void asyncMethod() {
        log.info("这是一个异步方法，指定该方法的线程名为{}", Thread.currentThread().getName());
    }

}
